package com.settlement.system.model.param;

import com.settlement.system.common.util.common.BeanValidator;
import jakarta.validation.ConstraintViolation;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author author
 */
public class ApiParams{

    public <T> String verifyBean(T t) {
        List<String> error = new ArrayList<>();
        ConstraintViolation validate = BeanValidator.validate(t);
        if (validate != null) {
            return validate.getMessage();
        }
        return null;
    }

    public String verifyBean(){
        return null;
    }

    public <T> String verify(T t){
        String message = verifyBean(t);
        if(StringUtils.isNotEmpty(message)){
            return message;
        }
        message = verifyBean();
        if(StringUtils.isNotEmpty(message)){
            return message;
        }
        return null;
    }
}
